package models;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author eagle_eye
 */
@Entity
@Table(name = "GRADO", catalog = "sischool2", schema = "")
@NamedQueries({
    @NamedQuery(name = "Grado.findAll", query = "SELECT g FROM Grado g"),
    @NamedQuery(name = "Grado.findByIdGrado", query = "SELECT g FROM Grado g WHERE g.idGrado = :idGrado"),
    @NamedQuery(name = "Grado.findByNumerocursos", query = "SELECT g FROM Grado g WHERE g.numerocursos = :numerocursos"),
    @NamedQuery(name = "Grado.findByNumeroasignaturas", query = "SELECT g FROM Grado g WHERE g.numeroasignaturas = :numeroasignaturas")})
public class Grado implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idGrado", nullable = false)
    private Integer idGrado;
    @Column(name = "numerocursos")
    private Integer numerocursos;
    @Column(name = "numeroasignaturas")
    private Integer numeroasignaturas;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "gradoId")
    private List<Asignatura> asignaturaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "gradoId")
    private List<Curso> cursoList;

    public Grado() {
    }

    public Grado(Integer idGrado) {
        this.idGrado = idGrado;
    }

    public Integer getIdGrado() {
        return idGrado;
    }

    public void setIdGrado(Integer idGrado) {
        this.idGrado = idGrado;
    }

    public Integer getNumerocursos() {
        return numerocursos;
    }

    public void setNumerocursos(Integer numerocursos) {
        this.numerocursos = numerocursos;
    }

    public Integer getNumeroasignaturas() {
        return numeroasignaturas;
    }

    public void setNumeroasignaturas(Integer numeroasignaturas) {
        this.numeroasignaturas = numeroasignaturas;
    }

    public List<Asignatura> getAsignaturaList() {
        return asignaturaList;
    }

    public void setAsignaturaList(List<Asignatura> asignaturaList) {
        this.asignaturaList = asignaturaList;
    }

    public List<Curso> getCursoList() {
        return cursoList;
    }

    public void setCursoList(List<Curso> cursoList) {
        this.cursoList = cursoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idGrado != null ? idGrado.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Grado)) {
            return false;
        }
        Grado other = (Grado) object;
        if ((this.idGrado == null && other.idGrado != null) || (this.idGrado != null && !this.idGrado.equals(other.idGrado))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "models.Grado[idGrado=" + idGrado + "]";
    }

}
